<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width ,initial-scale=1.0">
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/jquery.min.js"></script>
    <link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/bootstrap.css">
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/bootstrap.js"></script>
    <link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/uploadify.css">
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/jquery.uploadify.js"></script>
    <title>Insert title here</title>
<script type="text/javascript">
    $(function(){
    $("#image").uploadify({
        swf:$("#ctx").val()+"/resources/css/images/uploadify.swf",
        uploader:$("#ctx").val()+"/seller/uploadImage?sid="+$("#sid").val(),
        cancelImg:$("#ctx").val()+"/resources/img/uploadify-cancel.png",
        fileObjName:"image",
        auto:false
    });
    $("#uploadFile").click(function(){
        $("#image").uploadify("upload","*")
    });
    $("#fourimage").uploadify({
            swf:$("#ctx").val()+"/resources/css/images/uploadify.swf",
            uploader:$("#ctx").val()+"/seller/uploadFourImage?sid="+$("#sid").val(),
            cancelImg:$("#ctx").val()+"/resources/img/uploadify-cancel.png",
            fileObjName:"fourimage",
            auto:false
        });
    $("#uploadFile1").click(function(){
            $("#fourimage").uploadify("upload","*")
        });

    $("#detailimage").uploadify({
            swf:$("#ctx").val()+"/resources/css/images/uploadify.swf",
            uploader:$("#ctx").val()+"/seller/uploadDetailImage?sid="+$("#sid").val(),
            cancelImg:$("#ctx").val()+"/resources/img/uploadify-cancel.png",
            fileObjName:"detailimage",
            auto:false
        });
    $("#uploadFile2").click(function(){
            $("#detailimage").uploadify("upload","*")
        })


            })

</script>
</head>

<body>
<div class="container">
    <h3 class="page-header">商品添加</h3>
    <!--
     为表单添加.form-horizontal类
     将label和控件包裹在.control-group中
     为label添加.control-label类
     将任何相关的控件包裹在.controls中，以确保最佳的对齐
    -->
    <input type="hidden" id="sid" value="<%=session.getId()%>"/>
    <input type="hidden" id="ctx" value="<%=request.getContextPath() %>"/>

    <div class="row-fluid">
        <sf:form class="form-horizontal" method="post" modelAttribute="goods" enctype="multipart/form-data">
            <div class="span5">
                <div class="control-group">
                    <label class="control-label">商品名</label>
                    <div class="controls">
                        <sf:input type="text" path="name"   placeholder="Name" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">品牌</label>
                    <div class="controls">
                        <sf:input type="text"  path="brand"   placeholder="Brand" />
                    </div>
                </div>
                <div class="control-group">
                   <label class="control-label">品牌</label>
                   <div class="controls">
                    <sf:select type="text"  path="category"   placeholder="Brand" >
                        <sf:option value="bjb" >笔记本</sf:option>
                        <sf:option value="tsj">台式机</sf:option>
                        <sf:option value="pb">平板</sf:option>
                    </sf:select>
                   </div>
                </div>


                <div class="control-group">
                    <label class="control-label">处理器</label>
                    <div class="controls">
                        <sf:input type="text"  path="CPU"  placeholder="CPU" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">内存容量</label>
                    <div class="controls">
                        <sf:input type="text"  path="RAM"  placeholder="RAM" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">硬盘容量</label>
                    <div class="controls">
                        <sf:input type="text"  path="HD"  placeholder="HD" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">显卡</label>
                    <div class="controls">
                        <sf:input type="text"  path="graphic"  placeholder="Graphic" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">价格</label>
                    <div class="controls">
                        <sf:input type="text"  path="price"  placeholder="price" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">描述</label>
                    <div class="controls">
                        <sf:input type="text"  path="describer"  placeholder="Describer" />
                    </div>
                </div>
                <div class="controls" align="center">
                    <input class="btn btn-default" type="submit"  value="确定"/>
                </div>
            </div>
        </sf:form>


        <form class="form-horizontal">
            <div class="span5">
                <div class="control-group">
                    <label class="control-label">首页大图</label>
                    <div class="controls">
                        <div class="input-group">
                            <input type="file" id="image" name="image" class="form-control"/>
                   <span class="input-group-btn">
                   <button class="btn btn-default"  id="uploadFile"  type="button">上传图片</button>
                   </span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">四张小图</label>
                    <div class="controls">
                        <div class="input-group">
                            <input type="file" id="fourimage" name="fourImage" class="form-control"/>
                   <span class="input-group-btn">
                   <button class="btn btn-default"  id="uploadFile1"  type="button">上传图片</button>
                   </span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">详情图片</label>
                    <div class="controls">
                        <div class="input-group">
                            <input type="file" id="detailimage" name="detailImage" class="form-control"/>
                    <span class="input-group-btn">
                    <button class="btn btn-default"  id="uploadFile2"  type="button">上传图片</button>
                    </span>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

</body>
</html>
